﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DesignPatterns.Decorator
{
    public partial class FrmDecorator : FrmBase
    {
        public FrmDecorator()
        {
            InitializeComponent();

            btnStyle1.Click += BtnStyle1_Click;
            btnStyle2.Click += BtnStyle2_Click;
        }

        private void BtnStyle1_Click(object sender, EventArgs e)
        {
            var person = new Person() { Name = "张三" };

            var tshirt = new TShirts();
            var sneakers = new Sneakers();
            var bigTrouser = new BigTrouser();

            tshirt.Decorate(person);
            sneakers.Decorate(tshirt);
            bigTrouser.Decorate(sneakers);

            labResult.Text = bigTrouser.Show();
        }

        private void BtnStyle2_Click(object sender, EventArgs e)
        {
            var person = new Person() { Name = "张三" };

            var suit = new Suit();
            var tie = new Tie();
            var leatherShoes = new LeatherShoes();

            suit.Decorate(person);
            tie.Decorate(suit);
            leatherShoes.Decorate(tie);

            labResult.Text = leatherShoes.Show();
        }
    }
}
